package com.sxj.corejava.code07_面向对象;

/**
 * @author 石小俊
 * @date 2025年07月18日 14:05
 */
public class Test05_方法重载 {

    public static void main(String[] args) {
        Calculator calculator = new Calculator();
        System.out.println(calculator.sum(1,2));
        System.out.println(calculator.sum(1,2.0));
        System.out.println(calculator.sum(1.0,2.0));
        System.out.println(calculator.sum(1.0,2));
        System.out.println(calculator.sum(1,2,3));
    }

}

class Calculator{

    public int sum(int i,int j){
        return i + j;
    }
//    private int sum(int i,int j){
//        return i + j;
//    }
//    public double sum(int i,int j){
//        return i + j;
//    }
//    public int sum(int a,int a){
//        return a + b;
//    }

    public int sum(int i,int j, int k){
        return i + j + k;
    }

    public double sum(double i,int j){
        return i + j;
    }

    public double sum(int i,double j){
        return i + j;
    }

    public double sum(double i,double j){
        return i + j;
    }

}